package com.center.mapperscan;

import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.type.filter.AnnotationTypeFilter;

import java.util.Set;

/**
 * @Author dzl
 * @Date 2022/1/20 10:30 上午
 * 注解扫描器
 */
public class MyMapperClassScanner extends ClassPathBeanDefinitionScanner {

    public MyMapperClassScanner(BeanDefinitionRegistry registry, boolean useDefaultFilters) {
        super(registry, useDefaultFilters);
    }

    @Override
    protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
        addIncludeFilter(new AnnotationTypeFilter(MyMapper.class));
        return super.doScan(basePackages);
    }
}
